package com.alphasystem.commerce.common.model.translation;

import java.io.Serializable;

import com.alphasystem.commerce.common.util.HashCodeUtil;

/**
 * @author Farhan Syed Ali
 */
public class TranslationInfoPK implements Serializable {
	
	private static final long serialVersionUID = 2319821727101353043L;

	public static final String DEFAULT_COUNTRY = "ANY";

	protected String country;

	protected String id;

	protected String language;

	public TranslationInfoPK() {
		this(null, null, null);
	}

	public TranslationInfoPK(String id, String language, String country) {
		this.country = country;
		this.id = id;
		this.language = language;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj instanceof TranslationInfoPK) {
			TranslationInfoPK o = (TranslationInfoPK) obj;
			return o.getId().equals(id) && o.getLanguage().equals(language)
					&& o.getCountry().equals(country);
		}
		return false;
	}

	/**
	 * @return the country
	 */
	public String getCountry() {
		return country;
	}

	/**
	 * @return the productId
	 */
	public String getId() {
		return id;
	}

	/**
	 * @return the locale
	 */
	public String getLanguage() {
		return language;
	}

	@Override
	public int hashCode() {
		int result = HashCodeUtil.hash(id);
		result = HashCodeUtil.hash(result, language);
		return HashCodeUtil.hash(result, country);
	}

	/**
	 * @param country
	 *            the country to set
	 */
	public void setCountry(String country) {
		this.country = country;
	}

	/**
	 * @param id
	 *            the productId to set
	 */
	public void setId(String id) {
		this.id = id;
	}

	/**
	 * @param language
	 *            the locale to set
	 */
	public void setLanguage(String language) {
		this.language = language;
	}

	@Override
	public String toString() {
		return id + ":" + country + ":" + language;
	}
}
